/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elderberryni2.data.container;

import elderberryni2.abstracts.BaseTimestampable;
import elderberryni2.interfaces.IDumpable;

/**
 *
 * @author warringer
 */
public class HeadingContainer extends BaseTimestampable<Float>
    implements Comparable<HeadingContainer>, IDumpable {

    private float headX;
    private float headY;
    private float headZ;

    /**
     * 
     * @param headX
     * @param headY
     * @param headZ
     * @param timestamp
     */
    public HeadingContainer(float headX, float headY, float headZ, float timestamp) {
        this.headX = headX;
        this.headY = headY;
        this.headZ = headZ;
        this.setTimestamp(timestamp);
    }

    /**
     * 
     * @return
     */
    public float getHeadX() {
        return headX;
    }

    /**
     * 
     * @return
     */
    public float getHeadY() {
        return headY;
    }

    /**
     * 
     * @return
     */
    public float getHeadZ() {
        return headZ;
    }
    
    @Override
    public Float getTimestampDifference(Float timestamp) {
        return Math.abs(this.getTimestamp() - timestamp);
    }

    /**
     * 
     * @param t
     * @return
     */
    @Override
    public int compareTo(HeadingContainer t) {
        if (this.headX == t.getHeadX() && 
                this.headY == t.getHeadY() &&
                this.headZ == t.getHeadZ()) {
            return 0;
        } else {
            return 1;
        }
    }

    @Override
    public String toCSV() {
        return new Float(headX).toString() 
                + ";" + new Float(headY).toString() 
                + ";" + new Float(headZ).toString();
    }
    
    @Override
    public String getHeader() {
        return "Heading X;Heading Y;Heading Z";
    }
    
}
